﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO;

namespace ActivePalControls
{
    /// <summary>
    /// Interaction logic for GrouppedRichText.xaml
    /// </summary>
    public partial class GrouppedRichText : UserControl
    {
        public string GroupName
        {
            get { return gbHolder.Header.ToString(); }
            set { gbHolder.Header = value; }
        }

        public string RichValue
        {
            get { return new TextRange(rtbValue.Document.ContentStart, 
                                        rtbValue.Document.ContentEnd).Text; }
            set 
            {                
                MemoryStream stream =
                    new MemoryStream(ASCIIEncoding.Default.GetBytes(value));

                rtbValue.SelectAll();
                rtbValue.Selection.Load(stream, DataFormats.Rtf);
            }
        }


        public GrouppedRichText()
        {
            InitializeComponent();
        }
    }
}
